Maven resource 配置中include与exclude及其filter的使用 您所在的位置:网站首页 exclude from什么意思 Maven resource 配置中include与exclude及其filter的使用

Maven resource 配置中include与exclude及其filter的使用

2023-09-20 03:56| 来源: 网络整理| 查看: 265

Maven resource 中的与用于包含或排除某一文件目录下的文件是否是工程资源的。 若与划定的范围存在冲突,则以配置为准。 多数情况下,使用和是为了配合实现替换文件中的变量的需要。

include的作用: 使用include可以规定指定路径下的xml包括properties文件在编译期,将文件指定的@profiles.active@替换掉。 例如:XXX.properties中我们使用@profiles.active@来代表激活的偏好。那么在Maven编译时,就会将@profiles.active@替换成真正的偏好。

exclude的作用: 使用exclude可以规定指定路径下的配置文件,在编译后打包时不被放入资源路径里。

注: 如果与划定的范围存在冲突时 并不会执行,而是执行 include的使用示例:

src/main/resources true application.properties application-dev.properties application-test.properties application-prod.properties application-pressure.properties bootstrap.properties

exclude的使用示例:

src/main/resources application*.properties bootstrap*.properties

注:exclude里filtering的true、false值详解:

true与false相同点: exclude规定路径下的文件不被打包。 true与false不同点: true: 不在exclude排除路径下的文件执行include过滤。 false:不在exclude排除路径下的文件不执行include过滤。

include和exclude里filtering总结:

filtering为true: include:替换指定文件中@xx@表示的maven properties属性值 exclude:替换指定文件以外@xx@表示的maven properties属性值 filtering为false: include:不替换指定文件中@xx@表示的maven properties属性值 exclude:不替换指定文件以外@xx@表示的maven properties属性值 以上与划定的范围存在冲突,则以配置为准。


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有